home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / RTVBE210.ZIP / _WDPMI.H < prev    next >
C/C++ Source or Header  |  1996-09-07  |  12KB  |  245 lines

  1.  /*************************************************************************
  2. ; *
  3. ; *     File        : DPMI.C
  4. ; *
  5. ; *     Description : DPMI Functions
  6. ; *
  7. ; *     Portability : PC
  8. ; *
  9. ; *
  10. ; *     Copyright (C) 1995 RealTech
  11. ; *
  12. ; ************************************************************************/
  13. #ifndef _WDPMI
  14. #define _WDPMI
  15.  
  16. typedef struct {
  17.   unsigned short offset16;
  18.   unsigned short segment;
  19. } __dpmi_raddr;
  20.  
  21. typedef struct {
  22.   unsigned long  offset32;
  23.   unsigned short selector;
  24. } __dpmi_paddr;
  25.  
  26. typedef struct {
  27.   unsigned long handle;            /* 0, 2 */
  28.   unsigned long size;     /* or count */    /* 4, 6 */
  29.   unsigned long address;        /* 8, 10 */
  30. } __dpmi_meminfo;
  31.  
  32. typedef union {
  33.   struct {
  34.     unsigned long edi;
  35.     unsigned long esi;
  36.     unsigned long ebp;
  37.     unsigned long res;
  38.     unsigned long ebx;
  39.     unsigned long edx;
  40.     unsigned long ecx;
  41.     unsigned long eax;
  42.   } d;
  43.   struct {
  44.     unsigned short di, di_hi;
  45.     unsigned short si, si_hi;
  46.     unsigned short bp, bp_hi;
  47.     unsigned short res, res_hi;
  48.     unsigned short bx, bx_hi;
  49.     unsigned short dx, dx_hi;
  50.     unsigned short cx, cx_hi;
  51.     unsigned short ax, ax_hi;
  52.     unsigned short flags;
  53.     unsigned short es;
  54.     unsigned short ds;
  55.     unsigned short fs;
  56.     unsigned short gs;
  57.     unsigned short ip;
  58.     unsigned short cs;
  59.     unsigned short sp;
  60.     unsigned short ss;
  61.   } x;
  62.   struct {
  63.     unsigned char edi[4];
  64.     unsigned char esi[4];
  65.     unsigned char ebp[4];
  66.     unsigned char res[4];
  67.     unsigned char bl, bh, ebx_b2, ebx_b3;
  68.     unsigned char dl, dh, edx_b2, edx_b3;
  69.     unsigned char cl, ch, ecx_b2, ecx_b3;
  70.     unsigned char al, ah, eax_b2, eax_b3;
  71.   } h;
  72. } __dpmi_regs;
  73.   
  74. typedef struct {
  75.   unsigned char  major;
  76.   unsigned char  minor;
  77.   unsigned short flags;
  78.   unsigned char  cpu;
  79.   unsigned char  master_pic;
  80.   unsigned char  slave_pic;
  81. } __dpmi_version_ret;
  82.  
  83. typedef struct {
  84.   unsigned long largest_available_free_block_in_bytes;
  85.   unsigned long maximum_unlocked_page_allocation_in_pages;
  86.   unsigned long maximum_locked_page_allocation_in_pages;
  87.   unsigned long linear_address_space_size_in_pages;
  88.   unsigned long total_number_of_unlocked_pages;
  89.   unsigned long total_number_of_free_pages;
  90.   unsigned long total_number_of_physical_pages;
  91.   unsigned long free_linear_address_space_in_pages;
  92.   unsigned long size_of_paging_file_partition_in_pages;
  93.   unsigned long reserved[3];
  94. } __dpmi_free_mem_info;
  95.  
  96. typedef struct {
  97.   unsigned long total_allocated_bytes_of_physical_memory_host;
  98.   unsigned long total_allocated_bytes_of_virtual_memory_host;
  99.   unsigned long total_available_bytes_of_virtual_memory_host;
  100.   unsigned long total_allocated_bytes_of_virtual_memory_vcpu;
  101.   unsigned long total_available_bytes_of_virtual_memory_vcpu;
  102.   unsigned long total_allocated_bytes_of_virtual_memory_client;
  103.   unsigned long total_available_bytes_of_virtual_memory_client;
  104.   unsigned long total_locked_bytes_of_memory_client;
  105.   unsigned long max_locked_bytes_of_memory_client;
  106.   unsigned long highest_linear_address_available_to_client;
  107.   unsigned long size_in_bytes_of_largest_free_memory_block;
  108.   unsigned long size_of_minimum_allocation_unit_in_bytes;
  109.   unsigned long size_of_allocation_alignment_unit_in_bytes;
  110.   unsigned long reserved[19];
  111. } __dpmi_memory_info;
  112.  
  113. typedef struct {
  114.   unsigned long data16[2];
  115.   unsigned long code16[2];
  116.   unsigned short ip;
  117.   unsigned short reserved;
  118.   unsigned long data32[2];
  119.   unsigned long code32[2];
  120.   unsigned long eip;
  121. } __dpmi_callback_info;
  122.  
  123. typedef struct {
  124.   unsigned long size_requested;
  125.   unsigned long size;
  126.   unsigned long handle;
  127.   unsigned long address;
  128.   unsigned long name_offset;
  129.   unsigned short name_selector;
  130.   unsigned short reserved1;
  131.   unsigned long reserved2;
  132. } __dpmi_shminfo;
  133.  
  134.  
  135. /* Unless otherwise noted, all functions return -1 on error, setting __dpmi_error to the DPMI error code */
  136.  
  137. #ifdef __cplusplus
  138. extern "C" {
  139. #endif
  140. void    __dpmi_yield(void);                                    /* INT 0x2F AX=1680 */
  141.  
  142. int    __dpmi_allocate_ldt_descriptors(int _count);                        /* DPMI 0.9 AX=0000 */
  143. int    __dpmi_free_ldt_descriptor(int _descriptor);                        /* DPMI 0.9 AX=0001 */
  144. int    __dpmi_segment_to_descriptor(int _segment);                        /* DPMI 0.9 AX=0002 */
  145. int    __dpmi_get_selector_increment_value(void);                        /* DPMI 0.9 AX=0003 */
  146. int    __dpmi_get_segment_base_address(int _selector, unsigned long *_addr);            /* DPMI 0.9 AX=0006 */
  147. int    __dpmi_set_segment_base_address(int _selector, unsigned long _address);            /* DPMI 0.9 AX=0007 */
  148. unsigned long __dpmi_get_segment_limit(int _selector);                        /* LSL instruction  */
  149. int    __dpmi_set_segment_limit(int _selector, unsigned long _limit);                /* DPMI 0.9 AX=0008 */
  150. int    __dpmi_get_descriptor_access_rights(int _selector);                    /* LAR instruction  */
  151. int    __dpmi_set_descriptor_access_rights(int _selector, int _rights);            /* DPMI 0.9 AX=0009 */
  152. int    __dpmi_create_alias_descriptor(int _selector);                        /* DPMI 0.9 AX=000a */
  153. int    __dpmi_get_descriptor(int _selector, void *_buffer);                    /* DPMI 0.9 AX=000b */
  154. int    __dpmi_set_descriptor(int _selector, void *_buffer);                    /* DPMI 0.9 AX=000c */
  155. int    __dpmi_allocate_specific_ldt_descriptor(int _selector);                    /* DPMI 0.9 AX=000d */
  156.  
  157. int    __dpmi_get_multiple_descriptors(int _count, void *_buffer);                /* DPMI 1.0 AX=000e */
  158. int    __dpmi_set_multiple_descriptors(int _count, void *_buffer);                /* DPMI 1.0 AX=000f */
  159.  
  160. int    __dpmi_allocate_dos_memory(int _paragraphs, int *_ret_selector_or_max);            /* DPMI 0.9 AX=0100 */
  161. int    __dpmi_free_dos_memory(int _selector);                            /* DPMI 0.9 AX=0101 */
  162. int    __dpmi_resize_dos_memory(int _selector, int _newpara, int *_ret_max);            /* DPMI 0.9 AX=0102 */
  163.  
  164. int    __dpmi_get_real_mode_interrupt_vector(int _vector, __dpmi_raddr *_address);        /* DPMI 0.9 AX=0200 */
  165. int    __dpmi_set_real_mode_interrupt_vector(int _vector, __dpmi_raddr *_address);        /* DPMI 0.9 AX=0201 */
  166. int    __dpmi_get_processor_exception_handler_vector(int _vector, __dpmi_paddr *_address);    /* DPMI 0.9 AX=0202 */
  167. int    __dpmi_set_processor_exception_handler_vector(int _vector, __dpmi_paddr *_address);    /* DPMI 0.9 AX=0203 */
  168. int    __dpmi_get_protected_mode_interrupt_vector(int _vector, __dpmi_paddr *_address);    /* DPMI 0.9 AX=0204 */
  169. int    __dpmi_set_protected_mode_interrupt_vector(int _vector, __dpmi_paddr *_address);    /* DPMI 0.9 AX=0205 */
  170.  
  171. int    __dpmi_get_extended_exception_handler_vector_pm(int _vector, __dpmi_paddr *_address);    /* DPMI 1.0 AX=0210 */
  172. int    __dpmi_get_extended_exception_handler_vector_rm(int _vector, __dpmi_paddr *_address);    /* DPMI 1.0 AX=0211 */
  173. int    __dpmi_set_extended_exception_handler_vector_pm(int _vector, __dpmi_paddr *_address);    /* DPMI 1.0 AX=0212 */
  174. int    __dpmi_set_extended_exception_handler_vector_rm(int _vector, __dpmi_paddr *_address);    /* DPMI 1.0 AX=0213 */
  175.  
  176. int    __dpmi_simulate_real_mode_interrupt(int _vector, __dpmi_regs *_regs);            /* DPMI 0.9 AX=0300 */
  177. int    __dpmi_int(int _vector, __dpmi_regs *_regs); /* like above, but sets ss sp fl */    /* DPMI 0.9 AX=0300 */
  178. extern short __dpmi_int_ss, __dpmi_int_sp, __dpmi_int_flags; /* default to zero */
  179. int    __dpmi_simulate_real_mode_procedure_retf(__dpmi_regs *_regs);                /* DPMI 0.9 AX=0301 */
  180. int    __dpmi_simulate_real_mode_procedure_retf_stack(__dpmi_regs *_regs, int stack_bytes_to_copy, const void *stack_bytes); /* DPMI 0.9 AX=0301 */
  181. int    __dpmi_simulate_real_mode_procedure_iret(__dpmi_regs *_regs);                /* DPMI 0.9 AX=0302 */
  182. int    __dpmi_allocate_real_mode_callback(void (*_handler)(void), __dpmi_regs *_regs, __dpmi_raddr *_ret); /* DPMI 0.9 AX=0303 */
  183. int    __dpmi_free_real_mode_callback(__dpmi_raddr *_addr);                    /* DPMI 0.9 AX=0304 */
  184. int    __dpmi_get_state_save_restore_addr(__dpmi_raddr *_rm, __dpmi_paddr *_pm);        /* DPMI 0.9 AX=0305 */
  185. int    __dpmi_get_raw_mode_switch_addr(__dpmi_raddr *_rm, __dpmi_paddr *_pm);            /* DPMI 0.9 AX=0306 */
  186.  
  187. int    __dpmi_get_version(__dpmi_version_ret *_ret);                        /* DPMI 0.9 AX=0400 */
  188.  
  189. int    __dpmi_get_capabilities(int *_flags, char *vendor_info);                /* DPMI 1.0 AX=0401 */
  190.  
  191. int    __dpmi_get_free_memory_information(__dpmi_free_mem_info *_info);            /* DPMI 0.9 AX=0500 */
  192. int    __dpmi_allocate_memory(__dpmi_meminfo *_info);                        /* DPMI 0.9 AX=0501 */
  193. int    __dpmi_free_memory(unsigned long _handle);                        /* DPMI 0.9 AX=0502 */
  194. int    __dpmi_resize_memory(__dpmi_meminfo *_info);                        /* DPMI 0.9 AX=0503 */
  195.  
  196. int    __dpmi_allocate_linear_memory(__dpmi_meminfo *_info, int _commit);            /* DPMI 1.0 AX=0504 */
  197. int    __dpmi_resize_linear_memory(__dpmi_meminfo *_info, int _commit);            /* DPMI 1.0 AX=0505 */
  198. int    __dpmi_get_page_attributes(__dpmi_meminfo *_info, short *_buffer);            /* DPMI 1.0 AX=0506 */
  199. int    __dpmi_set_page_attributes(__dpmi_meminfo *_info, short *_buffer);            /* DPMI 1.0 AX=0507 */
  200. int    __dpmi_map_device_in_memory_block(__dpmi_meminfo *_info, unsigned long _physaddr);    /* DPMI 1.0 AX=0508 */
  201. int    __dpmi_map_conventional_memory_in_memory_block(__dpmi_meminfo *_info, unsigned long _physaddr); /* DPMI 1.0 AX=0509 */
  202. int    __dpmi_get_memory_block_size_and_base(__dpmi_meminfo *_info);                /* DPMI 1.0 AX=050a */
  203. int    __dpmi_get_memory_information(__dpmi_memory_info *_buffer);                /* DPMI 1.0 AX=050b */
  204.  
  205. int    __dpmi_lock_linear_region(__dpmi_meminfo *_info);                    /* DPMI 0.9 AX=0600 */
  206. int    __dpmi_unlock_linear_region(__dpmi_meminfo *_info);                    /* DPMI 0.9 AX=0601 */
  207. int    __dpmi_mark_real_mode_region_as_pageable(__dpmi_meminfo *_info);            /* DPMI 0.9 AX=0602 */
  208. int    __dpmi_relock_real_mode_region(__dpmi_meminfo *_info);                    /* DPMI 0.9 AX=0603 */
  209. int    __dpmi_get_page_size(unsigned long *_size);                        /* DPMI 0.9 AX=0604 */
  210.  
  211. int    __dpmi_mark_page_as_demand_paging_candidate(__dpmi_meminfo *_info);            /* DPMI 0.9 AX=0702 */
  212. int    __dpmi_discard_page_contents(__dpmi_meminfo *_info);                    /* DPMI 0.9 AX=0703 */
  213.  
  214. int    __dpmi_physical_address_mapping(__dpmi_meminfo *_info);                    /* DPMI 0.9 AX=0800 */
  215. int    __dpmi_free_physical_address_mapping(__dpmi_meminfo *_info);                /* DPMI 0.9 AX=0801 */
  216.  
  217. /* These next four functions return the old state */
  218. int    __dpmi_get_and_disable_virtual_interrupt_state(void);                    /* DPMI 0.9 AX=0900 */
  219. int    __dpmi_get_and_enable_virtual_interrupt_state(void);                    /* DPMI 0.9 AX=0901 */
  220. int    __dpmi_get_and_set_virtual_interrupt_state(int _old_state);                /* DPMI 0.9 AH=09   */
  221. int    __dpmi_get_virtual_interrupt_state(void);                        /* DPMI 0.9 AX=0902 */
  222.  
  223. int    __dpmi_get_vendor_specific_api_entry_point(char *_id, __dpmi_paddr *_api);        /* DPMI 0.9 AX=0a00 */
  224.  
  225. int    __dpmi_set_debug_watchpoint(__dpmi_meminfo *_info, int _type);                /* DPMI 0.9 AX=0b00 */
  226. int    __dpmi_clear_debug_watchpoint(unsigned long _handle);                    /* DPMI 0.9 AX=0b01 */
  227. int    __dpmi_get_state_of_debug_watchpoint(unsigned long _handle, int *_status);        /* DPMI 0.9 AX=0b02 */
  228. int    __dpmi_reset_debug_watchpoint(unsigned long _handle);                    /* DPMI 0.9 AX=0b03 */
  229.  
  230. int    __dpmi_install_resident_service_provider_callback(__dpmi_callback_info *_info);        /* DPMI 1.0 AX=0c00 */
  231. int    __dpmi_terminate_and_stay_resident(int return_code, int paragraphs_to_keep);        /* DPMI 1.0 AX=0c01 */
  232.  
  233. int    __dpmi_allocate_shared_memory(__dpmi_shminfo *_info);                    /* DPMI 1.0 AX=0d00 */
  234. int    __dpmi_free_shared_memory(unsigned long _handle);                    /* DPMI 1.0 AX=0d01 */
  235. int    __dpmi_serialize_on_shared_memory(unsigned long _handle, int _flags);            /* DPMI 1.0 AX=0d02 */
  236. int    __dpmi_free_serialization_on_shared_memory(unsigned long _handle, int _flags);        /* DPMI 1.0 AX=0d03 */
  237.  
  238. int    __dpmi_get_coprocessor_status(void);                            /* DPMI 1.0 AX=0e00 */
  239. int    __dpmi_set_coprocessor_emulation(int _flags);                        /* DPMI 1.0 AX=0e01 */
  240. extern int __tb;
  241.  
  242. #ifdef __cplusplus
  243. }
  244. #endif
  245. #endif